<style>
  /*LOGO*/
.logo{font-size:20px;color: #FFFFFF;}
.logo:hover{color: #FFFFFF;}
</style>
<nav style="background-color: #393D49">
    <ul class="layui-nav" lay-filter="" style = "width:1200px;margin:0 auto;">
        <a class="logo" href="#">{$siteInfo['title']}</a>
        <li class="layui-nav-item layui-this"><a href="/">首页</a></li>
        {volist name="nav[0]" id="vo"}
        <li class="layui-nav-item ">
          <a href="{$vo['url']}">{$vo['nav_title']}</a>
          {notempty name="nav[$vo.nav_id]"}
          <dl class="layui-nav-child">
             {volist name="nav[$vo.nav_id]" id="v"}
            <dd><a href="">{$v.nav_title}</a></dd>
            {/volist}
          </dl>
           {/notempty}
        </li>
        {/volist}
<!--       {empty name="userInfo"}-->
<!--       <button id="btn-login" style="margin-left: 45%;background: #EB7350;" class="layui-btn">登录</button>-->
<!--       <a href="/home/index/register" class="layui-btn">注册</a>-->
<!--       {/empty}-->
       {notempty name="userInfo"}  
        <li class='layui-nav-item' style='float: right;margin-right: 100px;'>
        </li>
        <li class='layui-nav-item' style='float: right;position: relative;left: -100px;'>
            <a href='javascript:;'><img src='{notempty name="userInfo.face"}{$userInfo["face"]}{/notempty}{empty name="userInfo.face"}/static/images/default_face.jpg{/empty}' class='layui-nav-img'>{$userInfo["username"]}</a>
            <dl class='layui-nav-child'>
                <dd><a href='/home/ucenter/index'>个人中心</a></dd>
                <dd><a href='/home/ucenter/exitLogin'>退出登录</a></dd>
            </dl>
        </li>
       {/notempty}
    </ul>
    <script>
        layui.use('element', function(){
            var element = layui.element;

            //…
        });
    </script>
</nav>
<!--登录注册-->
<div id="LoginDiv" style="display: none;padding-top:20px">
    <form  method="post" id="LoginForm" >
        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
               <input type="text" name="username" placeholder="手机号/邮箱/用户名" required lay-verify="required"  autocomplete="off" class="layui-input">
            </div>           
        </div>      
        <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
               <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
            </div>          
       </div>
       <div class="layui-form-item" id="code-div" style="display: none;">
            <label class="layui-form-label">验证码</label>
            <div class="layui-input-inline">
               <input style="width:80px;float:left;" type="text" name="code" required lay-verify="required" placeholder="验证码" autocomplete="off" class="layui-input">
               <img style="height:37px;width:110px;cursor: pointer;" id="code-img" style="margin-left:55px;margin-bottom:20px" src="{:captcha_src()}" id="yzm" onclick="this.src='{:captcha_src()}?x='+Math.random();" />
            </div>
       </div>          
       <input style="margin-left:55px;margin-bottom:20px;width:250px;" name="loginsubmit" id="btn_Login" class="layui-btn layui-btn-normal" type="button" value="登录" />
       <p style="margin-left:55px;color:#9F9FA6">第三方登录</p>
       <ul style="margin-left:55px;padding:10px">
         <li style="float:left;margin-right:10px;"><a href="#"><i class="layui-icon layui-icon-login-wechat" style="font-size: 30px; color: #5FB878;"></i></a></li>
         <li style="float:left;"><a href="#"><i class="layui-icon layui-icon-login-qq" style="font-size: 30px; color: #1E9FFF;"></i></a></li>
      </ul>
      <p style="margin-top:40px;text-align:center ;"><a href="{:url('/home/index/register')}">注册</a>|<a href="{:url('/home/index/register')}">忘记密码</a></p>
    </form>
</div>
<script>
    $('#btn-login').click(function(){
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.open({
                type: 1,
                title:'用户登录',
                area: ['370px', '410px'],
                content: $('#LoginDiv')
            });
        });
    })

    //登录JS
    $("#btn_Login").click(function(){
        var data = $("#LoginForm").serialize();
        $.ajax({
           type:"post",
            url:'/home/index/login',
            data:data,
            dataType:'json',
            success:function(e){
                switch(e.code)
                {                  
                    case 0:
                        if(e.count > 5){
                        $("#code-div").show();
                        }
                        layer.msg(e.msg, {icon: 5,time:1000});
                        document.getElementById('code-img').src='{:captcha_src()}?x='+Math.random()
                        break;
                    case 1:
                        layer.msg(e.msg, {icon:1});
                        location.href='/';
                        break;


                }

            },
        })
    })
</script>
<!--自定义JS代码-->
{$statistics|htmlspecialchars_decode}